package com.top10.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.top10.bean.ResponseBean;
import com.top10.entity.SearchKeyword;
import com.top10.service.ISearchKeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 搜索Conrtoller
 * @author ellen
 * @version 1.0
 * @date 2018/9/29 15:20
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    ISearchKeywordService searchKeywordService;

    @RequestMapping("/searchKeyword")
    public ResponseBean searchKeyword(){
        List<SearchKeyword> searchKeywords = searchKeywordService.selectList(new EntityWrapper<SearchKeyword>().orderBy("createtime", false));

        return ResponseBean.createSuccess().addData("searchKeywords", searchKeywords);
    }

}
